import { defineComponent, PropType, ref } from 'vue';
import s from './Center.module.scss';
const directionMap = {//表驱动
    "-": "horizontal",
    '|': "vartical",
    "horizontal": "horizontal",
    "vartical": "vartical"
}
export const Center = defineComponent({
    props: {
        direction: {//方向
            type: String as PropType<"-" | "|" | "horizontal" | "vartical">,
            default: "horizontal"
        }
    },
    setup: (props, context) => {
        // const extraClass = props.direction === "-" || props.direction === "horizontal" ? "horizontal" : "vartical" 可以写成表驱动
        const extraClass = directionMap[props.direction]
        return () => (
            <div class={[s.center, extraClass]}>{
                context.slots.dafault?.()
            }</div>

        )
    }
})



